package blms.facade;

import java.io.File;

import blms.system.BLMS;
import blms.system.exception.CreationException;
import blms.system.exception.InexistentUserException;
import blms.system.exception.UnknownUserAttribute;

/**
 * Facade that provides the methods to be performed by the test cases through easyaccept.
 *
 */
public class BLMSFacade {
	
	/**
	 * The system as a whole.
	 */
	private BLMS blms = new BLMS();;

	/**
	 * Removes all leagues from BMLS system.
	 */
	public void removeAllLeagues(){}
	
	/**
	 * Removes all matches from BMLS system.
	 */
	public void removeAllMatches(){}
	
	/**
	 * Removes all users from BMLS system.
	 */
	public void removeAllUsers(){}
	
	/**
	 * Finds an user given his last name.
	 * @param lastName The last name of the user to be found.
	 * @return 
	 */
	public String findUserByLastName(String lastName) throws InexistentUserException {
		throw new InexistentUserException(InexistentUserException.COULD_NOT_FIND_USER_MESSAGE+" "+lastName);
	}
	
	/**
	 * Creates user for the system.
	 * @param firstName The first name of the user.
	 * @param lastName The last name of the user.
	 * @param homePhone The home phone of the user.
	 * @param workPhone The work phone of the user.
	 * @param cellPhone The cell phone of the user.
	 * @param email The email of the user. This attribute will uniquely identify the user.
	 * @param picture A picture of the user.
	 * @return The ID of the user created.
	 * @throws CreationException 
	 */
	public String createUser(String firstName, String lastName, String homePhone, String workPhone, 
			String cellPhone, String email, File picture) throws CreationException {
		return this.blms.createUser(firstName, lastName, homePhone, workPhone,
				cellPhone, email, picture);
	}
	
	/**
	 * Returns the value of the required attribute from the user represented by the id.
	 * @param id The id of the user.
	 * @param attribute The attribute to be returned.
	 * @return the value of the required attribute from the user represented by the id.
	 */
	public String getUserAttribute(String id, String attribute) throws InexistentUserException, UnknownUserAttribute {
		return this.blms.getUserAttribute(id, attribute);
	}
	
	public void changeUserAttribute(String id, String attribute, String value) throws InexistentUserException, UnknownUserAttribute {
		this.blms.changeUserAttribute(id, attribute, value);
	}

}
